package com.gdk.ksoft.ui.sales.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gdk.ksoft.R;
import com.gdk.ksoft.data.entry.tables.SaleBuyOtherTable;

import java.util.List;

/**
 * Created by Mrper on 2014/12/26.
 * 购买它品促销类型数据适配器
 */
public class GiveOtherTypeAdapter extends BaseAdapter{

    private Context context;
    private List<SaleBuyOtherTable> list;

    public GiveOtherTypeAdapter(Context context, List<SaleBuyOtherTable> list){
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list == null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View rootView = View.inflate(context, R.layout.item_freports_lstreport,null);
        ((TextView)rootView.findViewById(R.id.item_freports_lstreport_itemText))
                .setText(list.get(position).zt);
        return rootView;
    }
}
